﻿@*
*@

@using System.Diagnostics;
@using System.Collections;
@using System.Reflection;
@using System.Runtime.Versioning;
@using Microsoft.AspNetCore.Http
@using NewLife.Common;
@using NewLife.Serialization
@inject IHttpContextAccessor HttpContextAccessor

@{
    var session = HttpContextAccessor.HttpContext.Session;
    var session2 = HttpContextAccessor.HttpContext.Items["Session"] as IDictionary<String, Object>;
    ViewBag.Title = "Session列表";
}

<div class="card scroll-x style-3">
    <div class="card-body p-0">
        <table class="table table-bordered table-hover table-striped table-condensed">
            <thead class="bg-white fw-bold fs-6 border border-bottom-3 border-gray-200">
                <tr>
                    <th colspan="6">
                        Session列表(@session.Keys.Count())
                    </th>
                </tr>
            </thead>
            <tbody class="border border-gray-200">
                <tr>
                    <th>名称</th>
                    <th>类型</th>
                    <th>数值</th>
                </tr>
                @foreach (String item in session.Keys)
                {
                    <tr>
                        <td>@item</td>
                        <td></td>
                        <td>@session.GetString(item)</td>
                    </tr>
                }
            </tbody>
        </table>


    </div>

</div>

@if (session2 != null)
{

    <div class="card mt-3 scroll-x style-3">
        <div class="card-body p-0">

            <table class="table table-bordered table-hover table-striped table-condensed">
                <thead class="bg-white fw-bold fs-6 border border-bottom-3 border-gray-200">
                    <tr>
                        <th colspan="6">
                            Session2列表(@session2.Count)
                        </th>
                    </tr>
                </thead>
                <tbody class="border border-gray-200">
                    <tr>
                        <th>名称</th>
                        <th>类型</th>
                        <th>数值</th>
                    </tr>
                    @foreach (var item in session2)
                    {
                        <tr>
                            <td>@item.Key</td>
                            <td>@item.Value?.GetType().FullName</td>
                            <td>@item.Value</td>
                        </tr>
                    }
                </tbody>
            </table>

        </div>

    </div>
}